package com.tuzhi.sys.web.controller;

import com.tuzhi.base.service.BaseService;
import com.tuzhi.base.web.controller.SimpleBaseController;
import com.tuzhi.base.web.helper.AjaxResultHelper;
import com.tuzhi.common.domain.ResultBO;
import com.tuzhi.sys.jpa.entity.SysDeptEntity;
import com.tuzhi.sys.service.SysDeptService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


@RestController
@RequestMapping("/sys/dept")
@Api(tags = "部门")
@Slf4j
public class SysDeptController extends SimpleBaseController<SysDeptEntity, Long, SysDeptEntity> {

    @Autowired
    private SysDeptService service;
    @Override
    protected BaseService getThisService() {
        return service;
    }


    //部门树形结构
    @ApiOperation("部门树形结构")
    @GetMapping("/treeDept")
    public ResultBO treeDept(){
        List<SysDeptEntity> sysDeptEntity=service.getTree();
        return AjaxResultHelper.success().setData(sysDeptEntity);
    }


}
